<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "shopping_cart".
 *
 * @property integer $id
 * @property integer $user_id
 * @property integer $product_id
 * @property string $title
 * @property string $img_url
 * @property string $product_price
 * @property integer $product_num
 * @property string $create_time
 * @property string $update_time
 */
class ShoppingCart extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public $price_unit = '';
    public static function tableName()
    {
        return 'shopping_cart';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['user_id', 'product_id', 'product_num'], 'integer'],
            [['product_price'], 'number'],
            [['product_num'], 'required'],
            [['create_time', 'update_time'], 'safe'],
            [['title', 'img_url'], 'string', 'max' => 255],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'user_id' => 'User ID',
            'product_id' => 'Product ID',
            'title' => 'Title',
            'img_url' => 'Img Url',
            'product_price' => 'Product Price',
            'product_num' => 'Product Num',
            'create_time' => 'Create Time',
            'update_time' => 'Update Time',
        ];
    }
}
